package com.cz.ssyx.home.contoller;

import com.cz.ssyx.common.auth.AuthContextHolder;
import com.cz.ssyx.common.result.Result;
import com.cz.ssyx.home.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @descriptions:
 * @author: Joker.
 * @date: 2024/4/30 16:48
 * @version: 1.0
 */

@RestController
@RequestMapping("api/home")
public class ItemApiController {

    @Autowired
    private ItemService itemService;

    //查看商品详情
    @GetMapping("item/{id}")
    public Result item(@PathVariable Long id) {
        Long userId = AuthContextHolder.getUserId();
        Map<String, Object> map = itemService.item(id, userId);
        return Result.ok(map);
    }
}
